import os
import random
import sys
import time

from re_common.baselibrary.utils.basefile import BaseFile

pathlist = os.path.dirname(os.path.abspath(__file__)).split(os.sep)
root_path = os.sep.join(pathlist[:pathlist.index("re-common") + 1])
sys.path.insert(0, root_path)
sys.path = list(set(sys.path))

from re_common.baselibrary.utils.basedir import BaseDir
from re_common.baselibrary.utils.myredisclient import MyRedis


class TestList_send():

    def __init__(self):
        self.cur_path1 = BaseDir.get_file_dir_absolute(__file__)
        self.configfile1 = BaseFile.get_new_path(self.cur_path1, "config.ini")
        self.redis_name = "redis_test"
        self.myredis = MyRedis(self.configfile1, sesc=self.redis_name).builder()

    def send(self):
        self.myredis.push("proxy1", 1, 2, 3, 4, 5, 6, 7, 8, 9)

    def get(self):
        while True:
            time.sleep(1)
            aa = self.myredis.brpop("proxy1", timeout=3)
            print(aa)
            print("*****")

    def remove(self):
        aa = self.myredis.delete("proxy1")


ts = TestList_send()
# ts.send()
ts.get()
# ts.remove()

